/******************************************************************************
 * The contents of this file are subject to the   JDI License  Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * The Initial Developer of the Original Code is 陈慧然. Portions created by 
 * 陈慧然 are Copyright 陈慧然.
 * All Rights Reserved.
 *
 *              Contact john_holen@163.com for licensing alternatives.
 *
 *****************************************************************************/


package org.peony.standard.unvarying.client.web;

import org.apache.commons.lang.math.RandomUtils;
import org.peony.client.web.components.table.Table;
import org.peony.standard.ui.SIClientAll;

/**
 *  
 *
 *  @author     陈慧然
 *  @version    Id: CssClassName.java, v 0.000 2008-4-25 下午06:24:20 陈慧然 Exp
 */
public class IdsAndCssClassName {
	/**
	 * DIV排列方式：水平排列
	 */
	public final static String CONTAINER_LAYOUT_WEBLAYOUTFLOWHORIZONTAL = "WEBLAYOUTFLOWHORIZONTAL";
	/**
	 * DIV排列方式：垂直排列
	 */
	public final static String CONTAINER_LAYOUT_WEBLAYOUTFLOWVERTICAL = "WEBLAYOUTFLOWVERTICAL";
	/**
	 * 位于表格中的可编辑项（单行，String）
	 */
	public final static String EDITABLE_TEXT_INLINE_IN_A_TABLE = "TEXTINLINEINATABLE";
	/**
	 * 可编辑项－文本框
	 */
	public final static String EDITABLE_TEXT = "EDITABLETEXT";
	/**
	 * 可编辑项－单行文本
	 */
	public final static String EDITABLE_INPUT = "EDITABLEINPUT";
	
	public final static String getComponentId(SIClientAll clientComponent){
		return clientComponent.getClass().getSimpleName().toUpperCase() + RandomUtils.nextLong();
	}
	
	private final static String HYPHENCOLNAMEANDRANDOMNUM = "000HYPHENCOLNAMEANDRANDOMNUM000";
	public final static String generateCellId(SIClientAll clientComponent,String id){
		return id + HYPHENCOLNAMEANDRANDOMNUM + clientComponent.getClass().getSimpleName().toUpperCase() + RandomUtils.nextLong();
	}
	public final static String getPureCellId(String id){
		return id.substring(0,id.indexOf(HYPHENCOLNAMEANDRANDOMNUM));
	}
}
